﻿<%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation="false" CodeBehind="shippu_regth.aspx.cs" Inherits="Catering.Catering_Page.Caipin.shippu_regth" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link rel="stylesheet" type="text/css" href="../../Style/head.css" />
    <link rel="stylesheet" type="text/css" href="../../Style/center.css" />
    <!--弹出框-->
    <link href="../../Style/zhezhao.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/zhezhao.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <!--右键菜单-->
    <script src="../../Scripts/rightContext/jquery.jeegoocontext.min.js" type="text/javascript"></script>
    <script src="../../Scripts/rightContext/jquery.livequery.js" type="text/javascript"></script>
    <link href="../../Scripts/rightContext/skins/cm_default/style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        var selected_name = null; //菜TD
        var selected_content = null; //菜原料TD

        var CurrentDateStart;
        var CurrentDate;
        var PostMenuData = new Array();

        function mouseCoords(ev) {
            if (ev.pageX || ev.pageY) {
                return { x: ev.pageX, y: ev.pageY };
            }
            return {
                x: ev.clientX + document.body.scrollLeft - document.body.clientLeft,
                y: ev.clientY + document.body.scrollTop - document.body.clientTop
            };
        }

        //右键菜单删除菜品
        function BindRightClickContext() {
            $('tr[Is_tzcai="true"]').jeegoocontext = null;
            $('tr[Is_tzcai="true"]').jeegoocontext('rightClick', {

                livequery: true,
                widthOverflowOffset: 0,
                heightOverflowOffset: 1,
                submenuLeftOffset: -4,
                submenuTopOffset: -5,
                onSelect: function (e, context) {
                    var RandomId = $(context).attr("id"); //拖的菜的唯一标识
                    $("#Hid_DelDish").val(RandomId);
                    $("#But_DelDish").trigger("click");
                }
            });
        }

        function fu_DelDish() {
            var RandomId = $("#Hid_DelDish").val();
            $("#" + RandomId).remove();
            $("#" + RandomId).remove();
            LoadENAll();
            YanZIsCunZai();
        }


        $(document).ready(function () {
            BindRightClickContext();

            //拖放菜
            $(document).mouseup(function () {
                if ($('#cai_info').css("display") == "none") {
                    return;
                }
                $('#cai_info').css("display", "none");
                if (selected_name == null) {
                    return;
                }
                var selected_id = $("#cai_info td[name='id']").text(); //菜ID
                var date = $(selected_name).parents("tr").attr("date");
                var FoodID = $(selected_name).parents("tr").attr("FoodID");
                $("#Hid_AddDish").val(selected_id + "|" + date + "|" + FoodID);
                $("#But_AddDish").trigger("click");
            });
        });

        function Dish_Add(str, date, FoodID) {
            var NewTr = $(str);
            NewTr.find("span[isNumber='true']").bind("click", ClickNumber);
            $(selected_name).append(NewTr);
            var NewTr_All = NewTr.clone();
            NewTr_All.find("div:first").attr("IsCunZai", "false");
            $("tbody[date='" + date + "'][FoodID='" + FoodID + "'][isAll='true']").append(NewTr_All);
            BindRightClickContext();
            LoadENAll();
            YanZIsCunZai();
        }

    </script>
    <!--拖拽菜品-->
    <script type="text/javascript">
        $(document).ready(function () {
            //$(document).bind("selectstart", function () { return false; });

            $(document).mousemove(function (event) {
                if ($("#cai_info", window.parent.document).css("display") == "block") {
                    $("#cai_info", window.parent.document).css("display", "none");
                    $('#cai_info').css("display", "block");
                }
                $('#cai_info').css({ left: event.pageX + 5 + 'px', top: event.pageY + 5 + 'px' });
            });

            $("div[CaiID]").mouseover(function () {
            });

            $("td[istz='true']").mouseover(function () {
                if ($('#cai_info').css("display") == "block") {
                    $("td[cid='divshipuarea']").css("background-color", "#dbf4df");
                    $(this).parent().find("td[cid='divshipuarea']").css("background-color", "#d4e99c");
                    selected_name = $(this).find("tbody");
                }
                else {
                    $("td[cid='divshipuarea']").css("background-color", "#dbf4df");
                    $(this).parent().find("td[cid='divshipuarea']").css("background-color", "#d4e99c");
                }
            });
        });
    </script>

    <!--显示隐藏DIV-->
    <script language="javascript" type="text/javascript">
        function ShowTabdiv(id, obj) {
            $(".Tab_table_0206").css("display", "none");
            $("#table_" + id).css("display", "block");

            $("#DateList li").removeClass("hover_Tab_li");
            $(obj).parents("li").addClass("hover_Tab_li");

            $("#HidDateTime").val($(obj).attr('date'));
            if (id != 1) {
                LoadENAll();
                $("#table_sheruliang").show();
            }
            else {
                $("#table_sheruliang").hide();
                $("#shiwu").hide();
            }
        }


        function shipu_list_Select(shipuid) {

            $("#HFshipuid").val(shipuid);
        }

        function But_shipu_list_Load() {
            var Rid = $("#Hidshipuid").val();
            var week = $("#shipuList tr[cid='" + Rid + "']").find("select option:selected").val();
            $("#HidshipuWeek").val(week);
            $("#but_Loadshipu").trigger("click");
        }

        function But_shipu_list_Select() {
            divhidel("divmain2", "divup2");
            $("#but_list").click();
        }
        function But_shipu_now_list_Select() {
            $("#but_now").click();


        }
    </script>

    <!--列表样式控制-->
    <script type="text/javascript">
        $(document).ready(function () {
            $("#shipuList tr").click(function () {
                $("#shipuList tr").css("background-color", "#fff");
                $(this).css("background-color", "#999");
                $("#Hidshipuid").val($(this).attr("cid"));
            });
        });
    </script>

    <!--获取营养量-->
    <script type="text/javascript">
        $(document).ready(function () {
            LoadENAll();

            $("#tr_FoodList a").click(function () {
                $("#tr_FoodList td").css("background-color", "#fff");
                $(this).parent().css("background-color", "#fd9407");
                $("#HidFoodID").val($(this).attr("uid"));
                LoadENAll();
            });

            $("td[IsFood='true']").click(function () {

                var fid = $(this).attr("foodid");
                $("#tr_FoodList td").css("background-color", "#fff");
                $("#tr_FoodList a").each(function () {
                    if ($(this).attr("uid") == fid) {
                        $(this).parent().css("background-color", "#fd9407");
                    }
                });
                $("#HidFoodID").val(fid);
                LoadENAll();
            });

            //需要进一步处理
            $("span[isNumber='true']").bind("click", ClickNumber);
        });

        function ClickNumber(evt) {
            var Randomid = $(this).attr("Randomid");
            var Rawid = $(this).attr("Rawid");
            $("span[Randomid='" + Randomid + "'][Rawid='" + Rawid + "']").unbind("click", ClickNumber);

            var inputNum = $("<input type=\"text\" Randomid=\"" + Randomid + "\" Rawid=\"" + Rawid + "\" value=\"" + $(this).text() + "\" style=\"width:30px;\" />")
            inputNum.bind("focusout", SetNumber);
            $(this).text("").append(inputNum);
            inputNum.focus();
            inputNum.select();

        }

        function SetNumber(evt) {
            var Number = $(this).val();
            var Randomid = $(this).attr("Randomid");
            var Rawid = $(this).attr("Rawid");
            $("#Hid_SetRawNumber").val(Randomid + "|" + Rawid + "|" + Number);
            $("span[Randomid='" + Randomid + "'][Rawid='" + Rawid + "']").html(Number).bind("click", ClickNumber);

            $("#But_SetRawNumber").trigger("click");
        }

        function fu_SetNumber(Randomid, Rawid, Number) {
            LoadENAll();
        }


        function fomatFloat(src, pos) {
            return Math.round(src * Math.pow(10, pos)) / Math.pow(10, pos);
        }

        function GetTdColor(num) {
            if (num < 80) {
                return "#068EE5";
            }
            else if (num > 120) {
                return "#f1116a";
            }
            else {
                return "#000";
            }
        }

        function LoadENAll() {
            var WeekID = $("#Dr_zhoulist").val();
            var strDate = $("#DateList li.hover_Tab_li a").attr("date");
            var FoodID = $("#HidFoodID").val();

            if (strDate == "") {
                $("#WeekName").text("");
            }
            else {
                $("#WeekName").text(strDate);
            }

            if (WeekID != null) {

                $("#Hid_GetEMAll").val(strDate + "|" + WeekID + "|" + FoodID);
                $("#But_GetEMAll").trigger("click");
            }
        }

        function fu_LoadENAll(strWeekPJList, strDayList, strSRLBZ, strdata3, strdata4, strshiwu) {
            var SRLBZ = strSRLBZ.split(',');
            var WeekPJlist = strWeekPJList.split(',');
            var Daylist = strDayList.split(',');

            var DayCount = parseFloat($("#HidDayCount").val());
            for (var i = 0; i < 24; i++) {
                $("#tr_NE_" + (i + 1).toString()).find("td[cid='Total']").text(fomatFloat(SRLBZ[i], 2));
                var totalDay = parseFloat($("#tr_NE_" + (i + 1).toString()).find("td[cid='Total']").text());
                var total = parseFloat($("#tr_NE_" + (i + 1).toString()).find("td[cid='Total']").text()) * DayCount;

                var NumWeekBL = fomatFloat((parseFloat(WeekPJlist[i]) / total * 100).toString(), 2);
                var NumDayBL = fomatFloat((parseFloat(Daylist[i]) / totalDay * 100).toString(), 2);

                $("#tr_NE_" + (i + 1).toString()).find("td[cid='WeekPJ']").text(fomatFloat(WeekPJlist[i], 2)).css("color", GetTdColor(NumWeekBL));
                $("#tr_NE_" + (i + 1).toString()).find("td[cid='WeekBL']").text((total == 0 ? "0" : NumWeekBL) + "%").css("color", GetTdColor(NumWeekBL));
                $("#tr_NE_" + (i + 1).toString()).find("td[cid='DayNum']").text(fomatFloat(Daylist[i], 2)).css("color", GetTdColor(NumDayBL));
                $("#tr_NE_" + (i + 1).toString()).find("td[cid='DayBL']").text((total == 0 ? "0" : NumDayBL) + "%").css("color", GetTdColor(NumDayBL));

            }
            //热量千焦
            $("#tr_NE2_1").find("td[cid='Total']").text(fomatFloat(SRLBZ[0] * 4.182, 2));

            var totalDay_2 = parseFloat($("#tr_NE2_1").find("td[cid='Total']").text());
            var total_2 = parseFloat($("#tr_NE2_1").find("td[cid='Total']").text()) * DayCount;
            var NumWeekBL_2 = fomatFloat((parseFloat(WeekPJlist[0] * 4.182) / total_2 * 100).toString(), 2);
            var NumDayBL_2 = fomatFloat((parseFloat(Daylist[0] * 4.182) / totalDay_2 * 100).toString(), 2);

            $("#tr_NE2_1").find("td[cid='WeekPJ']").text(fomatFloat(WeekPJlist[0] * 4.182, 2)).css("color", GetTdColor(NumWeekBL_2));
            $("#tr_NE2_1").find("td[cid='WeekBL']").text((total_2 == 0 ? "0" : NumWeekBL_2) + "%").css("color", GetTdColor(NumWeekBL_2));
            $("#tr_NE2_1").find("td[cid='DayNum']").text(fomatFloat(Daylist[0] * 4.182, 2)).css("color", GetTdColor(NumDayBL_2));
            $("#tr_NE2_1").find("td[cid='DayBL']").text((total_2 == 0 ? "0" : NumDayBL_2) + "%").css("color", GetTdColor(NumDayBL_2));

            //安全提示和经济评价
            $("#txt_jinjipj").val(strdata3);
            $("#txt_anquants").val(strdata4);

            //食物分类统计
            var shiwulist = strshiwu.split(',');
            for (var i = 0; i < shiwulist.length; i++) {
                var shiwutemp = shiwulist[i];
                var shiwutypeid = shiwutemp.split('|')[0];
                var shiwuCount = shiwutemp.split('|')[1];
                $("#shiwu_" + shiwutypeid).text(shiwuCount + "克");
            }
        }

    </script>
    <style type="text/css">
        .button_li_bg_none li
        {
            background-image: none;
            width:auto;            
            margin:0px;
            margin-left:10px;
            padding:0px;
        }
        .yi_img
        {
            display: block;
            border: 0px;
            float: left;
            padding-left:0px;
            color: #fff;
            cursor: pointer;
            background-image: url(../../Images/hdm_lt.gif);
            background-repeat: no-repeat;
            height: 28px;
            line-height: 28px;
        }
        .yi_img:hover
        {
            color: #000;
        }
        #rightMenu
        {
            background-color: #dbf4df;
        }
        #cai_info
        {
            position: absolute;
            border: 1px solid #2a77af;
            width: 200px; 
            min-height: 180px; 
            max-height:300px;
            z-index: 1001;
            background-color: #f9a000;
            display: none;
            padding: 5px;
            filter: Alpha(Opacity=90);
        }
        #cai_info li
        {
            width: 100%;
            margin-bottom: 5px;
            color: #fff;
        }
        .biaozhuncss td
        {
            text-align:center;
            
            }
        #tr_FoodList a:hover{ cursor:pointer;}
        
        .shiwu{clear:both; width:450px;padding-top:20px;}
        .shiwu h2{width:440px; height:33px; line-height:33px; font-weight:600; font-size:14px; color:#0c3b41; background:url(../../Images/shiwuh2.jpg) no-repeat left;padding-left:10px;}
        .shiwu_left{width:160px; float:left;}
        .shiwu_left li{width:160px; height:20px; line-height:20px; margin-top:10px;}
        .shiwu_left_span{width:100px; background-color:#e7e7e7; text-align:center; height:20px;display:-moz-inline-box; display:inline-block;margin-right:5px;}
        .shiwu_right{width:285px; float:left; margin-left:5px;padding-top:20px;}
    </style>
    <!--显示对应界面数据-->
    <script type="text/javascript">
        $(document).ready(function () {
            window.parent.LoadDish(); //加载食谱库
            window.parent.hide_zidong(); //控制控件显示与否 
            YanZIsCunZai();
        });

        //验证是否存在相同的菜
        function YanZIsCunZai() {
            var typeinfo1 = $("#HidTypeInfo1").val();
            var typeinfo2 = $("#HidTypeInfo2").val();
            var typeinfo3 = $("#HidTypeInfo3").val();

            $("div[IsCunZai='true']").each(function () {
                //每天可重复，每餐不能重复(主食)
                if (typeinfo1.indexOf("," + $(this).attr("TypeID") + ",") > -1) {
                    if ($("div[IsCunZai='true'][cid='" + $(this).attr("cid") + "'][FoodID='" + $(this).attr("FoodID") + "'][date='" + $(this).attr("date") + "']").length > 1) {
                        $(this).css("color", "Red");
                    }
                    else {
                        $(this).css("color", "#000");
                    }
                }
                //每天不能重复，每周可重复(小菜、糖食类)
                else if (typeinfo2.indexOf("," + $(this).attr("TypeID") + ",") > -1) {
                    if ($("div[IsCunZai='true'][cid='" + $(this).attr("cid") + "'][date='" + $(this).attr("date") + "']").length > 1) {
                        $(this).css("color", "Red");
                    }
                    else {
                        $(this).css("color", "#000");
                    }
                }
                //每天不能重复，每周不可重复(主菜)
                else if (typeinfo3.indexOf("," + $(this).attr("TypeID") + ",") > -1) {
                    if ($("div[IsCunZai='true'][cid='" + $(this).attr("cid") + "']").length > 1) {
                        $(this).css("color", "Red");
                    }
                    else {
                        $(this).css("color", "#000");
                    }
                }
            });

            $("div[IsCunZai='false']").each(function () {
                //每天可重复，每餐不能重复(主食)
                if (typeinfo1.indexOf("," + $(this).attr("TypeID") + ",") > -1) {
                    if ($("div[IsCunZai='false'][cid='" + $(this).attr("cid") + "'][FoodID='" + $(this).attr("FoodID") + "'][date='" + $(this).attr("date") + "']").length > 1) {
                        $(this).css("color", "Red");
                    }
                    else {
                        $(this).css("color", "#000");
                    }
                }
                //每天不能重复，每周可重复(小菜、糖食类)
                else if (typeinfo2.indexOf("," + $(this).attr("TypeID") + ",") > -1) {
                    if ($("div[IsCunZai='false'][cid='" + $(this).attr("cid") + "'][date='" + $(this).attr("date") + "']").length > 1) {
                        $(this).css("color", "Red");
                    }
                    else {
                        $(this).css("color", "#000");
                    }
                }
                //每天不能重复，每周不可重复(主菜)
                else if (typeinfo3.indexOf("," + $(this).attr("TypeID") + ",") > -1) {
                    if ($("div[IsCunZai='false'][cid='" + $(this).attr("cid") + "']").length > 1) {
                        $(this).css("color", "Red");
                    }
                    else {
                        $(this).css("color", "#000");
                    }
                }
            });
        }
    </script>

    <!--显示当前食谱-->
    <script type="text/javascript">
        function ShowDangQian() {
            $.ajax({
                type: "Post",
                url: "shippu_regth.aspx/GetdangQian",
                data: "{'str':'" + "temp" + " '}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    $("#div_shipu_main", window.parent.document).html(data.d);
                    window.parent.ShowDangQian();
                }
            });
        }
    </script>

    <!--自动生成食谱Js-->
    <script type="text/javascript">
        function zd_submit() {
            var strType = "";
            $("td[isDishType='true'] input").each(function () {
                var FoodID = $(this).attr("FoodID");
                var DishType = $(this).attr("TypeID");
                var DishTypes = $(this).attr("TypeInfoID");
                var Number = $(this).val();
                strType += FoodID + "|" + DishType + "|" + DishTypes + "|" + Number + ",";
            });

            $("#Hid_AutoGenerate").val(strType);
            $("#But_AutoGenerate").trigger("click");
        }

        function fu_zd_submit(str_return) {
            if (str_return == "OK") {
                alert("生成成功！");
                $("#but_Save").trigger("click");
            }
            else if (data.d == "NOType") {
                alert("主副类别设置有误，请重新设置！");
            }
        }

        function showImp() {
            divshow("div_Excel", "div1");
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
        <!--添加拖拽的菜品-->
        <asp:Button ID="But_AddDish" runat="server" OnClick="But_AddDish_Click" Style="display: none"/>
        <asp:HiddenField ID="Hid_AddDish" runat="server" Value="" />
        <!--删除菜品-->
        <asp:Button ID="But_DelDish" runat="server" OnClick="But_DelDish_Click" Style="display: none"/>
        <asp:HiddenField ID="Hid_DelDish" runat="server" Value="" />
        <!--修改原料用量-->
        <asp:Button ID="But_SetRawNumber" runat="server" OnClick="But_SetRawNumber_Click" Style="display: none"/>
        <asp:HiddenField ID="Hid_SetRawNumber" runat="server" Value="" />
        <!--自动生成食谱-->
        <asp:Button ID="But_AutoGenerate" runat="server" OnClick="But_AutoGenerate_Click" Style="display: none"/>
        <asp:HiddenField ID="Hid_AutoGenerate" runat="server" Value="" />
        <!--获取实际摄入量以及周平均值-->
        <asp:Button ID="But_GetEMAll" runat="server" OnClick="But_GetEMAll_Click" Style="display: none"/>
        <asp:HiddenField ID="Hid_GetEMAll" runat="server" Value="" />

        </ContentTemplate>
    </asp:UpdatePanel>
    <div id="cai_info">
    </div>
    <div id="rightMenu">
    </div>
    <!--作为右键菜单的载体-->
    <asp:HiddenField ID="HidDateTime" runat="server" Value="" />
    <asp:HiddenField ID="Hidshipuid" runat="server" />
    <asp:HiddenField ID="HidshipuWeek" runat="server" />
    <asp:HiddenField ID="HidDayCount" runat="server" />
    <asp:HiddenField ID="HidFoodID" runat="server" Value="-1" />
    <asp:HiddenField ID="HidTypeInfo1" runat="server" Value="" />
    <asp:HiddenField ID="HidTypeInfo2" runat="server" Value="" />
    <asp:HiddenField ID="HidTypeInfo3" runat="server" Value="" />
    <asp:HiddenField ID="HidWeekValue" runat="server" Value="" />
    <asp:Button ID="but_Loadshipu" runat="server" OnClick="but_input_Loadshipu_Click" Style="display: none" />
    <asp:Button ID="but_list" runat="server" OnClick="but_input_Click" Style="display: none" />

    <div class="left_CR" style="width: auto; background-image: none;">
        <!--群体配餐头部信息-->
        <div class="Condition_CR" id="div_Group" runat="server" style="width:790px;">
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td width="75" align="right">
                        配餐人群：
                    </td>
                    <td class="tdcolor" colspan="2">
                        <asp:Label ID="lbName" runat="server"></asp:Label>
                    </td>
                    <td class="td63" width="75">配餐周期：</td>
                    <td width="150" class="tdcolor"><asp:Label ID="lblzhouqi" ClientIDMode="Static" runat="server"></asp:Label></td>
                    <td width="30" align="right">周：</td>
                    <td width="85">
                        <asp:DropDownList ID="Dr_zhoulist" runat="server" AutoPostBack="True" OnSelectedIndexChanged="Dr_zhoulist_SelectedIndexChanged">
                        </asp:DropDownList>
                    </td>
                    <td width="80">&nbsp;</td>
                </tr>
                <tr>
                    <td align="right" width="75">
                        所属班组：
                    </td>
                    <td class="tdcolor" style="width:90px;">
                        <asp:Label ID="lblClass" runat="server"></asp:Label>
                    </td>
                    <td class="td63" style="width:45px;" align="right">人数：</td>
                    <td class="tdcolor">
                        <asp:Label ID="lblNumber" runat="server"></asp:Label>(人)
                    </td>
                    <td colspan="4">
                        <div class="button_ul button_li_bg_none">
                            <ul style="margin:0px; padding:0px; width:100%; clear:both;">
                                <li>
                                    <input type="button" id="Button4" onclick='divshow("divmain2","divup2")' class="yi_img"
                                        value="导入食谱" style="width:60px;" />
                                    <img src="../../Images/hdm_rt.gif" style="float: left;" width="5" height="28" />
                                </li>
                                <li style="display:none;">
                                    <input type="button" id="Button2" onclick="ShowDangQian()" class="yi_img" value="当前食谱"  style="width:60px;" />
                                    <img src="../../Images/hdm_rt.gif" style="float: left;" width="5" height="28" />
                                </li>
                                <li id="li_btn_zd">
                                    <input type="button" id="Button3" onclick='divshow("divmain2","div_zidong")' class="yi_img"
                                        value="自动生成食谱"  style="width:80px;" />
                                    <img src="../../Images/hdm_rt.gif" style="float: left;" width="5" height="28" />
                                </li>
                                <li>
                                    <asp:Button ID="but_Save" runat="server" Text="保存食谱" CssClass="yi_img" OnClick="but_Save_Click"  style="width:60px;" />
                                    <img src="../../Images/hdm_rt.gif" style="float: left;" width="5" height="28" />
                                </li>
                                <li id="li_btn_Exp">
                                    <asp:Button ID="but_Excel" runat="server" Text="导出Excel" CssClass="yi_img" OnClick="but_Excel_Click"  style="width:60px;" />
                                    <img src="../../Images/hdm_rt.gif" style="float: left;" width="5" height="28" />
                                </li>
                                <li id="li_btn_Imp">
                                    <input type="button" id="but_Imp" value="导入Excel" class="yi_img" onclick="showImp()"  style="width:60px;" />
                                    <img src="../../Images/hdm_rt.gif" style="float: left;" width="5" height="28" />
                                </li>
                            </ul>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
        <!--菜谱详细配置-->
        <div style="width: 100%; height:423px; overflow-y: auto;">
            <table width="100%" cellpadding="0" cellspacing="0" border="1">
                <tr>
                    <td colspan="2">
                        <div id="DateList" class="Tab_ul_0206">
                            <ul>
                                <li><a href="#" onclick="ShowTabdiv(1,this);return false;">全 部</a></li>
                                <li class="hover_Tab_li"><a href="#" id="SelectedWeek_a" date="<%=(this.WeekDatetime!=null&&this.WeekDatetime[this.strWeek[0]]!=null)?this.WeekDatetime[this.strWeek[0]].ToString():""%>" onclick="ShowTabdiv(2,this);return false;">星期一</a></li>
                                <li><a href="#" date="<%=(this.WeekDatetime!=null&&this.WeekDatetime[this.strWeek[1]]!=null)?this.WeekDatetime[this.strWeek[1]].ToString():""%>" onclick="ShowTabdiv(3,this);return false;">星期二</a></li>
                                <li><a href="#" date="<%=(this.WeekDatetime!=null&&this.WeekDatetime[this.strWeek[2]]!=null)?this.WeekDatetime[this.strWeek[2]].ToString():""%>" onclick="ShowTabdiv(4,this);return false;">星期三</a></li>
                                <li><a href="#" date="<%=(this.WeekDatetime!=null&&this.WeekDatetime[this.strWeek[3]]!=null)?this.WeekDatetime[this.strWeek[3]].ToString():""%>" onclick="ShowTabdiv(5,this);return false;">星期四</a></li>
                                <li><a href="#" date="<%=(this.WeekDatetime!=null&&this.WeekDatetime[this.strWeek[4]]!=null)?this.WeekDatetime[this.strWeek[4]].ToString():""%>" onclick="ShowTabdiv(6,this);return false;">星期五</a></li>
                                <li><a href="#" date="<%=(this.WeekDatetime!=null&&this.WeekDatetime[this.strWeek[5]]!=null)?this.WeekDatetime[this.strWeek[5]].ToString():""%>" onclick="ShowTabdiv(7,this);return false;">星期六</a></li>
                                <li><a href="#" date="<%=(this.WeekDatetime!=null&&this.WeekDatetime[this.strWeek[6]]!=null)?this.WeekDatetime[this.strWeek[6]].ToString():""%>" onclick="ShowTabdiv(8,this);return false;">星期日</a></li>
                            </ul>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td valign="top" id="tz_content">
                        <!--配餐信息-->
                        <div class="Tab_0206" style="float: left;">
                            <div class="Tab_table_0206" id="table_1" style="float: left; display: none;">
                                <table style="width: 900px; background-color: #dbf4df;" class="pgridtable" border="1"
                                    cellspacing="0" cellpadding="0">
                                    <thead>
                                        <tr>
                                            <th style="cursor: pointer" class="pgridtd" rowspan="2">
                                                餐别
                                            </th>
                                            <th style="height: 30px; cursor: default" class="pgridtd">
                                                星期一(Monday)
                                            </th>
                                            <th style="height: 30px; cursor: default" class="pgridtd">
                                                星期二(Tuesday)
                                            </th>
                                            <th style="height: 30px; cursor: default" class="pgridtd">
                                                星期三(Wednesday)
                                            </th>
                                            <th style="height: 30px; cursor: default" class="pgridtd">
                                                星期四(Thursday)
                                            </th>
                                            <th style="height: 30px; cursor: default" class="pgridtd">
                                                星期五(Friday)
                                            </th>
                                            <th style="height: 30px; cursor: default" class="pgridtd">
                                                星期六(Saturday)
                                            </th>
                                            <th style="height: 30px; cursor: default" class="pgridtd">
                                                星期日(Sunday)
                                            </th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <%
                                            if (this.WeekDatetime != null)
                                            {
                                                if (this.dt_FoodMealType != null && this.dt_FoodMealType.Rows.Count > 0)
                                                {
                                                    for (int i = 0; i < this.dt_FoodMealType.Rows.Count; i++)
                                                    { 
                                        %>
                                        <tr style="height: 100px" foodid="<%=this.dt_FoodMealType.Rows[i]["id"].ToString()%>">
                                            <td width="10%" align="center" style="cursor: pointer" class="pgridtd" cid="divshipuarea">
                                                <%=this.dt_FoodMealType.Rows[i]["FMName"].ToString()%>
                                            </td>
                                            <%
                                                        for (int j = 0; j < this.strWeek.Length; j++)
                                                        {
                                                            if (this.WeekDatetime[this.strWeek[j]] != null)
                                                            { 
                                            %>
                                            <td width="10%" valign="top" cid="divshipuarea">
                                                <table width="100%">
                                                    <tbody isAll="true" date="<%=this.WeekDatetime[this.strWeek[j]] %>" FoodID="<%=this.dt_FoodMealType.Rows[i]["id"].ToString()%>">
                                                        <%
                                                                if (ViewState["dt_Recipes"] != null)
                                                                {
                                                                    System.Data.DataTable dt_Recipes = (System.Data.DataTable)ViewState["dt_Recipes"];
                                                                    if (dt_Recipes != null && dt_Recipes.Rows.Count > 0)
                                                                    {
                                                                        foreach (System.Data.DataRow row in dt_Recipes.Select("Date='" + this.WeekDatetime[this.strWeek[j]].ToString() + "' and FMID='" + this.dt_FoodMealType.Rows[i]["id"].ToString() + "'"))
                                                                        { 
                                                        %>
                                                        <%=GetCaiHtmlByData(row["CID"].ToString(), row["RandomID"].ToString(), this.dt_FoodMealType.Rows[i]["id"].ToString(), this.WeekDatetime[this.strWeek[j]].ToString(),true, true)%>
                                                        <%
                                                                        }
                                                                    }
                                                                }
                      
                                                        %>
                                                    </tbody>
                                                </table>
                                            </td>
                                            <%
    }
    else
    { 
                                            %>
                                            <td width="10%" valign="top" cid="divshipuarea">
                                                <table width="100%">
                                                    <tbody>
                                                    </tbody>
                                                </table>
                                            </td>
                                            <%
    }
}
                                            %>
                                        </tr>
                                        <%
                                                    }
                                                }
                                            }
                                        %>
                                    </tbody>
                                </table>
                            </div>
                            <%
                                for (int intweek = 2; intweek <= 8; intweek++)
                                { 
                                    %>
                                    <div class="Tab_table_0206" id="table_<%=intweek.ToString()%>" style="width: auto; float: left; display:<%=(intweek==2)?"block":"none"%>;">
                                <table style="width: 300px; background-color: #dbf4df;" id="pgriddivshipuarea" class="pgridtable"
                                    border="1" cellspacing="0" cellpadding="0">
                                    <thead>
                                        <tr>
                                            <th style="cursor: pointer;" class="pgridtd" rowspan="2">
                                                餐别
                                            </th>
                                            <th style="height: 30px; cursor: default" class="pgridtd">
                                                星期<%=this.strWeekByCh[intweek - 2].ToString()%>(<%=this.strWeek[intweek-2].ToString()%>)
                                            </th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <%
                                            if (this.WeekDatetime != null && this.WeekDatetime[this.strWeek[intweek - 2].ToString()] != null)
                                            {
                                                if (this.dt_FoodMealType != null && this.dt_FoodMealType.Rows.Count > 0)
                                                {
                                                    for (int i = 0; i < this.dt_FoodMealType.Rows.Count; i++)
                                                    { 
                                        %>
                                        <tr IsFood="true" style="height: 100px" foodid="<%=this.dt_FoodMealType.Rows[i]["id"].ToString()%>"
                                            date="<%=this.WeekDatetime[this.strWeek[intweek-2].ToString()].ToString()%>">
                                            <td IsFood="true" foodid="<%=this.dt_FoodMealType.Rows[i]["id"].ToString()%>" width="15%" align="center" style="cursor: pointer" class="pgridtd" cid="divshipuarea">
                                                <%=this.dt_FoodMealType.Rows[i]["FMName"].ToString()%>
                                            </td>
                                            <td width="85%" valign="top" cid="divshipuarea" istz="true">
                                                <table width="100%">
                                                    <tbody>
                                                        <%
                                                        if (ViewState["dt_Recipes"] != null)
                                                        {
                                                            System.Data.DataTable dt_Recipes = (System.Data.DataTable)ViewState["dt_Recipes"];
                                                            if (dt_Recipes != null && dt_Recipes.Rows.Count > 0)
                                                            {
                                                                foreach (System.Data.DataRow row in dt_Recipes.Select("Date='" + this.WeekDatetime[this.strWeek[intweek - 2].ToString()].ToString() + "' and FMID='" + this.dt_FoodMealType.Rows[i]["id"].ToString() + "'"))
                                                                { 
                                                        %>
                                                        <%=GetCaiHtmlByData(row["CID"].ToString(), row["RandomID"].ToString(), this.dt_FoodMealType.Rows[i]["id"].ToString(), this.WeekDatetime[this.strWeek[intweek - 2].ToString()].ToString(),true,false)%>
                                                        <%
                                                                }
                                                            }
                                                        } 
                                                        %>
                                                    </tbody>
                                                </table>
                                            </td>
                                        </tr>
                                        <%
                                            }
                                                }
                                            }
                                        %>
                                        
                                    </tbody>
                                </table>
                            </div>
                                    <%
                                }    
                            %>
                        </div>
                        <div style="clear:both">
                            <table>
                                <tbody>
                                    <tr>
                                        <td>
                                            食谱经济评价(单位：元)：
                                        </td>
                                    </tr>
                                    <tr>
                                            <td><asp:TextBox ID="txt_jinjipj" runat="server" CssClass="input_bg" TextMode="MultiLine" style="width:300px;height:80px;"></asp:TextBox></td>
                                        </tr>
                                        <tr>
                                            <td>
                                                食谱安全提示：
                                            </td>
                                        </tr>
                                        <tr>
                                            <td><asp:TextBox ID="txt_anquants"  runat="server" CssClass="input_bg" TextMode="MultiLine" style="width:98%;height:80px;"></asp:TextBox></td>
                                        </tr>
                                </tbody>
                            </table>
                        </div>
                        <div style="clear:both; height:0px; margin:0px; padding:0px; overflow:hidden;"></div>
                    </td>
                    <td valign="top" style="padding-top:10px;">
                        <!--元素含量信息-->
                        <table border="1" cellspacing="0" cellpadding="0" class="biaozhuncss" style="width:450px;" id="table_sheruliang">
                                <thead>
                                    <tr>
                                        <td colspan="7">
                                           <table border="1" cellpadding="0" cellspacing="0" style="width:100%">
                                                <thead id="tr_FoodList">
                                                    <tr>
                                                        <td style="height:35px; background-color:#fd9407;"><a uid="-1">全天</a></td>
                                                        <%
                                                            if (dt_FoodMealType != null && dt_FoodMealType.Rows.Count > 0)
                                                            {
                                                                for (int i = 0; i < dt_FoodMealType.Rows.Count; i++)
                                                                {
                                                                    if (dt_FoodMealType.Rows[i]["FMName"].ToString() == "上午茶" || dt_FoodMealType.Rows[i]["FMName"].ToString() == "下午茶")
                                                                        continue;
                                                                    %>
                                                                        <td><a uid="<%=dt_FoodMealType.Rows[i]["id"].ToString() %>"><%=dt_FoodMealType.Rows[i]["FMName"].ToString()%></a></td>
                                                                    <%
                                                                }
                                                            }
                                                             %>
                                                    </tr>
                                                </thead>
                                           </table> 
                                        </td>
                                    </tr>
                                    <tr>
                                        <td rowspan="2" style="height:60px;">营养素摄入量</td>
                                        <td rowspan="2" style="height:30px;">标准推荐量</td>
                                        <td colspan="2">周平均</td>
                                        <td colspan="2" id="WeekName">星期一</td>
                                    </tr>
                                    <tr>
                                        <td>实际</td>
                                        <td>比率%</td>
                                        <td>实际</td>
                                        <td>比率%</td>
                                    </tr>
                                </thead>
                                <tbody id="tbody_NElements">
                                    <%
                                        if (this.dt_NElements != null && this.dt_NElements.Rows.Count > 0)
                                        {
                                            for (int i = 0; i < dt_NElements.Rows.Count; i++)
                                            {
                                                if (dt_NElements.Rows[i]["id"].ToString() == "1") //热量
                                                {
                                                     %>
                                                     <tr id="tr_NE_<%=dt_NElements.Rows[i]["id"].ToString() %>">
                                                        <td style="height:20px;">
                                                        <%=dt_NElements.Rows[i]["Elements"].ToString()%>
                                                        (<%=
                                                             dt_NElements.Rows[i]["Company"].ToString()
                                                        %>)
                                                        </td>
                                                        <td cid="Total"></td>
                                                        <td cid="WeekPJ"></td>
                                                        <td cid="WeekBL"></td>
                                                        <td cid="DayNum"></td>
                                                        <td cid="DayBL"></td>
                                                     </tr>
                                                    <tr id="tr_NE2_<%=dt_NElements.Rows[i]["id"].ToString() %>">
                                                        <td style="height:20px;"><%=dt_NElements.Rows[i]["Elements"].ToString()%>(千僬)</td>
                                                        <td cid="Total"></td>
                                                        <td cid="WeekPJ"></td>
                                                        <td cid="WeekBL"></td>
                                                        <td cid="DayNum"></td>
                                                        <td cid="DayBL"></td>   
                                                    </tr>
                                                     <%
                                                }
                                                else //其他元素
                                                { 
                                                     %>
                                                    <tr id="tr_NE_<%=dt_NElements.Rows[i]["id"].ToString() %>">
                                                        <td style="height:20px;"><%=dt_NElements.Rows[i]["Elements"].ToString()%>(<%=dt_NElements.Rows[i]["Company"].ToString()%>)</td>
                                                        <td cid="Total"></td>
                                                        <td cid="WeekPJ"></td>
                                                        <td cid="WeekBL"></td>
                                                         <td cid="DayNum"></td>
                                                        <td cid="DayBL"></td>
                                                    </tr>
                                                <%
                                                }
                                               
                                            }
                                            %>
                                            <tr>
                                                <td colspan="7" style="height:20px;">
                                                不足：<span style="color:#068EE5">比率<80%</span>过量:<span style="color:#f1116a">比率>120%</span>适量：<span>比率80%~120%</span>
                                                </td>
                                            </tr>
                                            <%
                                        }
                                         %>
                                </tbody>
                            </table>
                        <!--食物来源统计-->
                        <div style="clear:both; height:0px; margin:0px; padding:0px; overflow:hidden;"></div>
                        <div class="shiwu" id="shiwu">
                            <h2>不同类别食物来源</h2>
                            <div style="clear:both; margin:0px; padding:0px;">
                            <ul class="shiwu_left">
                                <%
                                    if (this.dt_RawMaterialsType != null && this.dt_RawMaterialsType.Rows.Count > 0)
                                    {
                                        foreach (System.Data.DataRow row in this.dt_RawMaterialsType.Rows)
                                        { 
                                            %>
                                                <li><span class="shiwu_left_span"><%=row["Name"].ToString() %></span><span id="shiwu_<%=row["id"].ToString()%>">0克</span></li>
                                            <%
                                        }
                                    }     
                                %>
                            </ul>
                            <div class="shiwu_right">
                                <img src="../../Images/ssbt.jpg" width="283" height="241" />
                            </div>
                            </div>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
        <div style="height: 10px;">
        </div>
        <!--评价信息-->
        <table width="100%" border="0" cellpadding="0" cellspacing="0" style="display:none;">
            <tr>
                <td>
                    食谱经济评价:
                    <asp:TextBox ID="txt_jinji" runat="server" Text="" Style="width: 250px; height: 60px;"
                        TextMode="MultiLine"></asp:TextBox>
                </td>
                <td>
                    安全提示:
                    <asp:TextBox ID="txt_yingyang" runat="server" Text="" Style="width: 250px; height: 60px;"
                        TextMode="MultiLine"></asp:TextBox>
                </td>
            </tr>
        </table>
    </div>
    <!--遮罩层-->
    <div id="divmain2" class="bg">
    </div>
    <!--弹出层-->
    <div id="divup2" class="center_div" style="padding:0px;margin-top:-120px; left:40%;">
        <table style="width: 100%">
            <tr>
                <td>
                    <div class="div_0207 left_width400" style="width: 100%">
                        <h1>
                            <img src="../../Images/cp_h1_03.gif" />食谱库</h1>
                        <div style="height: 200px; overflow-y: auto;">
                            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="swxx_table">
                                <thead>
                                    <tr>
                                        <td style="width: 100px">
                                            名称
                                        </td>
                                        <td>
                                            周期
                                        </td>
                                        <td style="width: 80px">
                                            配餐起始时间
                                        </td>
                                        <td style="width: 130px">
                                            配餐截至时间
                                        </td>
                                    </tr>
                                </thead>
                                <tbody id="shipuList">
                                    <asp:Repeater ID="Rep_shipuList" runat="server">
                                        <ItemTemplate>
                                            <tr cid="<%#Eval("id")%>">
                                                <td>
                                                    <%#Eval("CateringName")%>
                                                </td>
                                                <td>
                                                    <select name="shipu_zouList">
                                                        <%#GetZhouOptionByRid(Eval("id").ToString())%>
                                                    </select>
                                                </td>
                                                <td>
                                                    <%#Convert.ToDateTime(Eval("StateDate")).ToShortDateString()%>
                                                </td>
                                                <td>
                                                    <%#Convert.ToDateTime(Eval("StopDate")).ToShortDateString()%>
                                                </td>
                                            </tr>
                                        </ItemTemplate>
                                    </asp:Repeater>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </td>
            </tr>
        </table>
        <table style="width: 100%">
            <tr>
                <td align="right">
                    <input type="button" id="Load_Repice" value="确定" class="input_btn_a" onclick="But_shipu_list_Load()" />
                    <input type="button" id="Edit_Repice" value="确定" class="input_btn_a" onclick="But_shipu_list_Select()" />
                </td>
                <td align="left">
                    <input type="button" value="关闭" class="input_btn_a" onclick="divhidel('divmain2','divup2');" />
                </td>
            </tr>
        </table>
    </div>
    <!--遮罩层-->
    <div id="div1" class="bg">
    </div>
    <!--自动生成食谱-->
    <div id="div_zidong" class="center_div" style="width:600px;margin-top:-100px;padding:10px 10px; left:35%;height:400px; overflow-y:scroll;">
        <table border="0" cellpadding="0" cellspacing="0" style="width:100%;">
            <tr>
                <td colspan="6" style="height:25px;">能量分配比例：</td>
            </tr>
            <tr>
                <td style="height:25px;">早餐：<asp:TextBox ID="txt_bili_zao" Text="3" runat="server" CssClass="input_bg" style="width:50px;"></asp:TextBox></td>
                <td>中餐：<asp:TextBox ID="txt_bili_zhong" Text="4" runat="server" CssClass="input_bg" style="width:50px;"></asp:TextBox></td>
                <td>晚餐：<asp:TextBox ID="txt_bili_wan" Text="3" runat="server" CssClass="input_bg" style="width:50px;"></asp:TextBox></td>
                <td>夜餐：<asp:TextBox ID="txt_bili_ye" Text="4" runat="server" CssClass="input_bg" style="width:50px;"></asp:TextBox></td>
                <td></td>
                <td></td>
            </tr>
        </table>
        <table border="0" cellpadding="0" cellspacing="0" style="width:100%;margin-top:10px;">
            <tbody>
                <tr>
                    <td colspan="6" style="height:25px;">菜品种数分类:</td>
                </tr>
                <%
                    if (this.dt_FoodMealType != null && this.dt_FoodMealType.Rows.Count > 0)
                    {
                        foreach (System.Data.DataRow row in this.dt_FoodMealType.Rows)
                        {
                            if (row["FMName"].ToString() == "上午茶" || row["FMName"].ToString() == "下午茶")
                                continue;
                            %>
                            <tr>
                                <td colspan="6" style="height:25px;width:60px; background-color:#ccc;">
                                    <%=row["FMName"].ToString()%>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="6" isDishType="true" FoodID="<%=row["id"].ToString()%>" id="td_zdType_<%=row["id"].ToString()%>">
                                    <div style="padding:10px 0px;">
                                    <%
                            foreach (System.Data.DataRow rowAutoType in this.dt_AutoRecipe.Select("FoodID=" + row["id"].ToString()))
                            { 
                                %>
                                    <span style="display:-moz-inline-box; display:inline-block; width:155px;">
                                    <%=new Catering_Rules.DishType().GetModel(Convert.ToInt32(rowAutoType["TypeID"].ToString())).DT %>
                                    -
                                    <%=Convert.ToInt32(rowAutoType["TypeInfoID"].ToString())==-1?"全部":new Catering_Rules.DishTypes().GetModel(Convert.ToInt32(rowAutoType["TypeInfoID"].ToString())).DTName %>
                                    :
                                    <input type="text" name="txt_auto" style="width:40px;" FoodID="<%=rowAutoType["FoodID"].ToString() %>" TypeID="<%=rowAutoType["TypeID"].ToString() %>" TypeInfoID="<%=rowAutoType["TypeInfoID"].ToString() %>" value="<%=rowAutoType["Number"].ToString() %>" />
                                    </span>
                                <%
                            }
                                    %>
                                    </div>
                                </td>
                            </tr>
                            <%
                        }
                    }     
                %>
                
            </tbody>
        </table>
        <table  border="0" cellpadding="0" cellspacing="0" width="100%">
            <tbody>
                <tr>
                    <td align="right"><input type="button" name="btn_zhidong" onclick="zd_submit()" value="确定" class="input_btn_a" /></td>
                    <td align="left"><input type="button" class="input_btn_a" onclick="divhidel('divmain2','div_zidong')" value="取消" /></td>
                </tr>
            </tbody>
        </table>
        <div  style=" clear:both;height:10px;"></div>
    </div>
    <!--导入食谱Excel-->
    <div id="div_Excel" class="center_div" style="width:350px; margin-top:-120px; padding:10px 10px;">
        <table border="0" cellpadding="0" cellspacing="0" style="width:100%;">
            <tr>
                <td><asp:FileUpload ID="file_Excel" runat="server" /></td>
                <td><asp:Button ID="But_ExcelImp" runat="server" OnClick="But_ExcelImp_Click" Text="确定" CssClass="input_btn_a" /></td>
            </tr>
        </table>
        <table border="0" cellpadding="0" cellspacing="0" style="width:100%;">
            <tr>
                <td align="center"><input type="button" value="关闭" onclick="javascript:divhidel('div_Excel', 'div1');" class="input_btn_a" /></td>
            </tr>
        </table>
    </div>
    <!--  Context menu -->
    <ul id="rightClick" class="jeegoocontext cm_default">
        <li id="delete">删除</li>
    </ul>
        
</form>
</body>
</html>
